package com.study.springcloudgateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description:
 * @author: ljr
 * @time 2021/3/26 16:58
 */
@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator routeLocator(RouteLocatorBuilder builders){
        return builders.routes().route("order_route", (predicateSpec)->{
            return predicateSpec.path("/order-service/**")
                    .uri("lb://spring-cloud-order-service");
        }).build();
    }

}
